#!/bin/bash

# installpkg squashfs-tools cdrtools lzo lz4

bash ./modbuild keep

THIS=$(dirname $(readlink -f $0))

rm -f /vmlinuz
cat /boot/vmlinuz-6* > /vmlinuz

sed -i -r 's/^LIVEKITNAME.*/LIVEKITNAME="slax"/' $THIS/../../config
sed -i -r 's/^NETWORK.*/NETWORK=true/' $THIS/../../config

SKIPINITRFS=true
SKIPCOREMOD=true
cd ../../
. ./build

cd initramfs
. ./initramfs_create

echo $INITRAMFS
mv -f $INITRAMFS.img $LIVEKITDATA/$LIVEKITNAME/boot/initrfs.img
cp -vfR $THIS/bootfiles/* $LIVEKITDATA/$LIVEKITNAME/boot/

mv /tmp/*.sb $LIVEKITDATA/$LIVEKITNAME/modules

rm -f /vmlinuz
